import sys
import subprocess
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.initUI()

    def initUI(self):
        # 创建一个按钮
        btn = QPushButton('运行Python文件', self)
        btn.resize(btn.sizeHint())
        btn.move(50, 50)

        # 连接按钮的点击事件到槽函数
        btn.clicked.connect(self.run_python_file)

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('运行Python文件')
        self.show()

    def run_python_file(self):
        # 使用subprocess模块运行另一个Python文件
        #subprocess.Popen(['python', r'E:\Private.Net\WorkShop\tqsdk\Tq\auto_stp10_stable01.py'])
        subprocess.Popen(['python', r'..\..\auto_stp10_stable01.py'])

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = MainWindow()
    sys.exit(app.exec_())